﻿using System;
using ChapterX.Common;

namespace ChapterX.Modules
{
    public partial class GlobalMessageModule : System.Web.UI.UserControl
    {
        public void ClearMessages()
        {
            Label_InfoMessage.Text = String.Empty;
            Panel_InfoMessage.Visible = false;

            Label_ErrorMessage.Text = String.Empty;
            Panel_ErrorMessage.Visible = false;
        }

        public void SetInfoMessage(String message)
        {
            ClearMessages();

            if (Utils.HasValue(message))
            {
                Label_InfoMessage.Text = message;
                Panel_InfoMessage.Visible = true;
            }
        }

        public void SetErrorMessage(String message)
        {
            ClearMessages();

            if (Utils.HasValue(message))
            {
                Label_ErrorMessage.Text = message;
                Panel_ErrorMessage.Visible = true;
            }
        }
    }
}